package com.heluo.eduservice.controller;


import com.heluo.commonutils.R;
import com.heluo.eduservice.entity.subject.OneSubject;
import com.heluo.eduservice.service.EduSubjectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import org.springframework.web.multipart.MultipartFile;

import java.util.List;

/**
 * <p>
 * 课程科目 前端控制器
 * </p>
 *
 * @author testjava
 * @since 2022-04-06
 */
@RestController
@RequestMapping("/eduservice/subject")
public class EduSubjectController {

    @Autowired
    private EduSubjectService subjectService;


    //获取上传文件
    @PostMapping("addSubject")
    public R addSubject(MultipartFile file){


        subjectService.saveSubject(file,subjectService);
        return R.ok();
    }
    @GetMapping("getAllSubject")
    public R nestedList(){
        List<OneSubject> subjectNestedVoList = subjectService.getAllOneTwoSubject();
        return R.ok().data("list", subjectNestedVoList);
    }

}

